<?php
session_start();
 
$come_url=strtolower(trim($_SERVER['HTTP_REFERER']));

if ($come_url==''){

	echo '<br><p align=center><font color="red">对不起，为了系统安全，不允许直接输入地址访问本系统的后台管理页面。</font></p>';

	exit();

}

else {

	$come_url=parse_url($come_url);

	if (strtolower($come_url['host'])!=strtolower($_SERVER['SERVER_NAME'])){

		echo '<br><p align=center><font color="red">对不起，为了系统安全，不允许从外部链接地址访问本系统的后台管理页面。</font></p>';

		exit();

	}

}

$admin_user=$_COOKIE['admin_user'];

if (preg_match('/^\w{32}$/',$admin_user)==0){

	$admin_user='';

}

else{

	$query=mysql_query("select * from admin where a_md5='$admin_user'");

	if (mysql_num_rows($query)==0){

		$admin_user='';

	}

	else{

		$row=mysql_fetch_array($query);

		$admin_user=$row['a_user'];

	}

}

if ($admin_user=='' && stripos($_SERVER['PHP_SELF'],'check_login.php')===false){

	echo '<br><p align=center><font color="red">身份登录已经超时,请重新<a href="login.php" target="_top">登录</a>!</font></p>';

	exit();

}

if ($_SESSION['adminname']=='' && stripos($_SERVER['PHP_SELF'],'check_login.php')===false){

	echo '<br><p align=center><font color="red">身份登录已经超时,请重新<a href="login.php" target="_top">登录</a>!</font></p>';

	exit();

}



function RsField($rs_sql){

	$rs_query=mysql_query($rs_sql);

	if (mysql_num_rows($rs_query)>0){

		$rs_row=mysql_fetch_row($rs_query);

		return $rs_row[0];

	}

	else {

		return '';

	}

}

function RsField_Array($rs_sql){

	$rs_query=mysql_query($rs_sql);

	if (mysql_num_rows($rs_query)>0){

		$rs_row=mysql_fetch_row($rs_query);

		return $rs_row;

	}

	else {

		return '';

	}

}

function RsNum($rs_sql){

	$rs_query=mysql_query($rs_sql);

	return mysql_num_rows($rs_query);

}



function NoData(){

	if ($language=='en'){

		return '<p class="nodata">No Data...</p>';

	}

	else {

		return '<p class="nodata">没有数据...</p>';

	}
}



function NoDatas($language){

	if ($language=='en'){

		return '<p class="nodata">No Data...</p>';

	}

	else {

		return '<p class="nodata">没有数据...</p>';

	}

}



$act=$_GET['act'];

$id=$_GET['id'];

$meter=$_GET['meter'];

$meter2=$_GET['meter2'];

$meter3=$_GET['meter3'];

$indexs=$_GET['indexs'];

$search_key=$_GET['search_key'];

$page_show=true;

$page_size=15;

$page=intval($_GET['page']);

if ($page<=0){

	$page=1;

}

$urls='meter='.$meter.'&meter2='.$meter2.'&meter3='.$meter3.'&search_key='.$search_key.'&indexs='.$indexs.'&page='.$page;

?>